package com.example.wan1.view.coin;

import com.example.wan1.data.BaseObserver;
import com.example.wan1.data.RetrofitUtil;
import com.example.wan1.data.RxSchedulers;
import com.example.wan1.model.CoinBean;

import javax.inject.Inject;

/***
 * 创建时间：2020/7/25 9:30
 * 创建人：10850
 * 功能描述：
 */
public class LoginCoinPresenter implements LoginCoinContract.Presenter {
    @Inject
    LoginCoinContract.View mView;

    @Inject
    public LoginCoinPresenter() {
    }

    @Override
    public void getselfCoin() {
        RetrofitUtil.getInstance().getCoin()
                .compose(RxSchedulers.observableIO2Main())
                .subscribe(new BaseObserver<CoinBean>() {
                    @Override
                    public void onSuccess(CoinBean result) {
                        mView.selfCoinSuccess(result);
                    }

                    @Override
                    public void onFailure(Throwable e, String errorMsg) {
                        mView.selfCoinFailure(e.getMessage());
                    }
                });
    }
}
